import React,{Component} from "react";
import { glabalContext } from './common/js/globalData'
class ToChild3 extends Component {
  state = { 
    a:20,
    b:12
   }
  render() { 
    console.log('this',this);
    return (
      <div>
          子组件child3,使用contextType简化Consumer<br/>
         {/* 使用contextType读取全局共享数据 */}
         role:{this.context.role}<br/>
         admin:{this.context.email}
         <button onClick={()=>this.context.updateRole('张')}>context-updateRole-修改role</button>
      </div>
    );
  }
}
ToChild3.contextType = glabalContext
export default ToChild3;